This forum is closed to new posts and
responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:
RE: same lotusscript agent extremely slow on Domino 6 ~Laura Desresagenobu 29.Oct.03 10:09 PM a Web browser Domino Designer 6.0.1 CF1Windows 2000
Here are the details. The agent adds a new field to each document, sets the value of the field, sets values in a couple of other existing fields, saves the document, copies it to an archive database, then gets the next doc in the view and repeats the procedure. This is done for three different views. Here's the code;
Dim s As New notessession
Set db = s.currentdatabase
Dim ardb As notesdatabase
Dim view As notesview
Dim vc As NotesViewEntryCollection
Dim LogView As NotesView
Dim PPView As NotesView
Dim doc As notesdocument
Dim PayPeriodDoc As NotesDocument
Dim TACount As Long
Dim TASCount As Long
Dim NameList(1 To 2) As String
Set ardb = New notesdatabase("","Paycheck_Archive_Test.nsf")
Set view = db.getview("T&A Forms")
Set vc = view.allentries
Set LogView = db.GetView("(Process Log)")
Set PPView = db.GetView("(Pay Periods)")
Set doc=view.getfirstdocument
TACount = 0
LogStr$ = Now & " " & db.server & " " & "Archived T&As" & Chr$(10)
' Archiving TAs
Do Until doc Is Nothing
Set archived = New notesitem(doc, "Archived", Now)
Set Item = doc.GetFirstItem("TA_History")
item.Values = Cstr(item.Values(0)) & LogStr$
Set item = doc.GetFirstItem("OrgCode")
subbur$ = Left(item.text,2)
If subbur$ = "HR" Then subbur$ = "NCS"
If subbur$ = "BC" Then subbur$ = "NCS"
If subbur$ = "ST" Then subbur$ = "NCS"
AdminGrpPtr$ = subbur$ & " PayCheck Admin"
NameList( 1 ) = "BLM_PayCheck_Admin"
NameList( 2 ) = AdminGrpPtr$
Set item = doc.GetFirstItem("StateAdmin")
item.Values = NameList
NameList( 1 ) = "BLM_PayCheck_Admin"
NameList( 2 ) = AdminGrpPtr$
Set item = doc.GetFirstItem("Authors")
item.Values = NameList
Call doc.save(False,False)
Call doc.copytodatabase(ardb)
TACount= TACount + 1
Set doc=view.getnextdocument(doc)
Loop
' Archiving Supplementals
Set view = db.getview("(T&A Supplemental)")
Set doc = view.getfirstdocument
TASCount = 0
Do Until doc Is Nothing
Set archived = New notesitem(doc, "Archived", Now)
Set Item = doc.GetFirstItem("TA_History")
item.Values = Cstr(item.Values(0)) & LogStr$
Set item = doc.GetFirstItem("OrgCode")
subbur$ = Left(item.text,2)
If subbur$ = "HR" Then subbur$ = "NCS"
If subbur$ = "BC" Then subbur$ = "NCS"
If subbur$ = "ST" Then subbur$ = "NCS"
AdminGrpPtr$ = subbur$ & " PayCheck Admin"
NameList( 1 ) = "BLM_PayCheck_Admin"
NameList( 2 ) = AdminGrpPtr$
Set item = doc.GetFirstItem("StateAdmin")
item.Values = NameList
NameList( 1 ) = "BLM_PayCheck_Admin"
NameList( 2 ) = ""
Set item = doc.GetFirstItem("Authors")
item.Values = NameList
Call doc.save(False,False)
Call doc.copytodatabase(ardb)
TASCount= TASCount + 1
Set doc=view.getnextdocument(doc)
Loop
' Archiving Amendments
Set view = db.getview("(T&A Amendments)")
Set doc = view.getfirstdocument
TAACount = 0
Do Until doc Is Nothing
Set archived = New notesitem(doc, "Archived", Now)
Set Item = doc.GetFirstItem("TA_History")
item.Values = Cstr(item.Values(0)) & LogStr$
Set item = doc.GetFirstItem("OrgCode")
subbur$ = Left(item.text,2)
If subbur$ = "HR" Then subbur$ = "NCS"
If subbur$ = "BC" Then subbur$ = "NCS"
If subbur$ = "ST" Then subbur$ = "NCS"
AdminGrpPtr$ = subbur$ & " PayCheck Admin"
'TKGrpPtr$ = subbur$ & " PayCheck Timekeepers"
NameList( 1 ) = "BLM_PayCheck_Admin"
NameList( 2 ) = AdminGrpPtr$
Set item = doc.GetFirstItem("StateAdmin")
item.Values = NameList
NameList( 1 ) = "BLM_PayCheck_Admin"
NameList( 2 ) = AdminGrpPtr$
Set item = doc.GetFirstItem("Authors")
item.Values = NameList
Call doc.save(False,False)
Call doc.copytodatabase(ardb)
TAACount= TAACount + 1
Set doc=view.getnextdocument(doc)
Loop
'Update Log
Set PayPeriodDoc = PPView.GetDocumentByKey("True")
PayYear$ = PayPeriodDoc.PayPeriodYear(0)
PayPeriod$ = PayPeriodDoc.PayPeriodNumber(0)
If Len(PayPeriod$) = 1 Then PayPeriod$ = "0" & PayPeriod$
LogPayPeriodPtr$ = PayYear$ & " - " & PayPeriod$
LogMsg$ = Now & " " & db.server & " " & "Archived " & Cstr(TACount) & " T&A's and " & Cstr(TASCount) & " Supplemental T&As and " & Cstr(TAACount) & " Amendments for pay period " & LogPayPeriodPtr$ & Chr$(10)
Set LogView = db.getview("(Process Log)")
Set Logdoc = Logview.GetDocumentByKey(LogPayPeriodPtr$)
logdoc.log = logdoc.log(0) & LogMsg$
Call logdoc.save(False,False)